#pragma once

#include "SFML\Graphics\RenderWindow.hpp"
#include "SFML\System\String.hpp"
#include "SFML\System\Clock.hpp"
#include "KeyboardInput.hpp"
#include <vector>

namespace rh
{
	class GameScreen;

	class Game 
	{
	protected:
		enum GameState { Uninitialized, ShowingSplash, Paused, 
			ShowingMenu, Playing, Exiting };

		static sf::RenderWindow _renderWindow;
		static const int MAX_FRAME_TIME_mS = 42;

		sf::String _name;
		unsigned int _screenWidth;
		unsigned int _screenHeight;

		GameState _gameState;
		sf::Clock _masterClock;
		sf::Clock _updateClock;

		std::vector<GameScreen*> _gameScreens;

		bool IsExiting(void);
		virtual void GameLoop(void);

		virtual void DrawLogic(void);
		virtual void GameLogic(void);

	public:
		Game(sf::String name = "NA", int screenWidth = 128, int screenHeight = 128);
		~Game(void);
		void Start(void);

		const sf::Time GetApplicationRunningTime();
		const sf::Time GetElapsedTime();

		void AddGameScreen(GameScreen* gameScreen);
		void RemoveGameScreen(GameScreen* gameScreen);
	};
};